package com.tomcov.client.place;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.tomcov.client.ClientFactory;
import com.tomcov.client.activities.CreatUserActivity;
import com.tomcov.client.activities.I18nActivity;
import com.tomcov.client.activities.LicenceActivity;
import com.tomcov.client.activities.MapActivity;
import com.tomcov.client.activities.MessageInActivity;
import com.tomcov.client.activities.MessageOutActivity;
import com.tomcov.client.activities.SettingsActivity;
import com.tomcov.client.activities.WelcomActivity;

public class AppActivityMapper implements ActivityMapper {
    private ClientFactory clientFactory;

    public AppActivityMapper(ClientFactory clientFactory) {
        //super();
        this.clientFactory = clientFactory;
    }

    @Override
    public Activity getActivity(Place place) {
        if (place instanceof WelcomPlace)
            return new WelcomActivity(clientFactory);
        else if (place instanceof I18nPlace)
            return new I18nActivity(clientFactory);
        else if (place instanceof MapPlace)
            return new MapActivity(clientFactory);
        else if (place instanceof CreatUserPlace)
            return new CreatUserActivity(clientFactory);
        else if (place instanceof LicencePlace)
            return new LicenceActivity(clientFactory);
        else if (place instanceof MessageOutPlace)
            return new MessageOutActivity(clientFactory);
        else if (place instanceof MessageInPlace)
            return new MessageInActivity(clientFactory);
        else if (place instanceof SettingsPlace)
            return new SettingsActivity(clientFactory);
        return null;
    }
}
